﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SIPO.master" AutoEventWireup="false"
    CodeFile="recImpositionlistAlllist.aspx.cs" Inherits="SIPO.Web.Lists.Administration.Catalog.recImpositionlistAlllist" %>

<asp:Content ID="ctnBody" ContentPlaceHolderID="body" runat="server">
    <link type="text/css" rel="stylesheet" href="<%= ResolveUrl("~/styles/ui.jqgrid.css") %>" />
    <script type="text/javascript" src="<%= ResolveUrl("~/scripts/i18n/grid.locale-id.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/scripts/jquery.jqGrid.min.js") %>"></script>
    <script src="<%= ResolveUrl("~/scripts/helper.js") %>" type="text/javascript"></script>
    <div>
        <button id="btnReview" type="button" onclick="OpenForm('historikoreksi');">
            Histori Koreksi</button>
    </div>
    <br />
    <br />
    <table id="table" class="scroll" cellpadding="0" cellspacing="0">
    </table>
    <div id="pager" class="scroll">
    </div>
    <br />
    <div id="dialog" title="Default dialog">
    </div>

    <script type="text/javascript">
        $("#btnReview").button({ icons: { primary: "ui-icon-pencil"} });

    </script>

    <script type="text/javascript">

        var handlerUrl = '<%= ResolveUrl("~/AjaxHandler/Transaction/recImpositionhandler.ashx") %>';

        $('#table').jqGrid({
         url: handlerUrl + '?method=getdata',
            datatype: 'json',
            colNames: ['ID', 'Sub Sub Sector', 'Nama Perusahaan', 'Dasar Pengenaan', 'Tahun', 'Nilai Pengenaan OJK', 'Nilai Pengenaan Debitur', 'Kewajiban', 'Status'],
            colModel: [
                    { name: 'ImpositionID', hidden: true, index: 'ImpositionID', width: 5 },
                    { name: 'recSubSubSector.SubSubSectorName', index: 'SubSubSectorName', width: 300 },
                    { name: 'recDebtor.DebtorName', index: 'DebtorName', width: 200 },
                    { name: 'recImpositionBase.ImpositonBaseName', index: 'ImpositonBaseName', width: 100 },
                    { name: 'Year', index: 'Year', width: 50 },
                    { name: 'OJKValue', index: 'OJKValue', width: 150, formatter: 'currency', formatoptions: { prefix: '', suffix: '', thousandsSeparator: ',' }, align: 'right' },
                    { name: 'DebtorValue', index: 'DebtorValue', width: 150, formatter: 'currency', formatoptions: { prefix: '', suffix: '', thousandsSeparator: ',' }, align: 'right' },
                    { name: 'TariffValue', index: 'TariffValue', width: 100, formatter: 'currency', formatoptions: { prefix: '', suffix: '', thousandsSeparator: ',' }, align: 'right' },
                    { name: 'ImpositionID', index: 'ImpositionID', align: 'center', formatter: returnMyLink, width: 100 }
                    
           	],
            rowNum: 10,
            id: 'ImpositionID',
            multiselect: true,
            rowList: [5, 10, 15, 20],
            pager: '#pager',
            sortname: 'recImposition.ImpositionID',
            sortorder: "asc",
            viewrecords: true,
            jsonReader: { repeatitems: false },
            width: 1300,
            height: '100%',
            caption: 'Dasar Pengenaan Iuran Berkala',
            ajaxGridOptions: { cache: false }
        });


        function returnMyLink(cellValue, options, rowdata) {
            
            var handleurlDownload = '<%= ResolveUrl("~/ajaxhandler/loaddata/downloadhandler.ashx") %>';
            return "<a target='_blank' href='" + handleurlDownload + "?sanction_id=" + cellValue + "' >download</a>";
        }

        $("#table").jqGrid('navGrid', '#pager', { edit: false, add: false, del: false, searchtext: 'Search', refreshtext: 'Refresh' },
        {}, {}, {}, { closeOnEscape: true, multipleSearch: true, closeAfterSearch: true });

        function OpenForm(ctl) {

            var formUrl = '<%= ResolveUrl("~/forms/transaction/recImpositionform.aspx") %>';

            var grid = $('#table');
            var selIds = grid.jqGrid('getGridParam', 'selarrrow'),
                selText = [];
            $.each(selIds, function () {
                selText.push(grid.jqGrid('getCell', this, 'ImpositionID'));
            });

            if (ctl == 'historikoreksi') {

                if (selIds.length == 0) {
                }
                else if (selIds.length > 1) {
                    alert('Pilih satu record untuk ubah data.');
                }
                else {
                    $('#dialog').load(formUrl + '?id=' + selText + '&menuid=' + '<%= base.MenuID %>').dialog({ autoOpen: false, modal: true, width: 600, title: 'Ubah Dasar Pengenaan' });
                    $("#dialog").dialog('open');
                }
            }
    
    </script>

</asp:Content>
